<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
    <link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
    <link rel="stylesheet" href="${staticServer}/css/work_today.css" />
    <link rel="stylesheet" href="${staticServer}/css/lanrenzhijia.css" />
    <link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
    <script src="${staticServer}/inc/js/jquery.js"></script>
    <script src="${staticServer}/inc/js/infopad.js?2.2"></script>
    <script src="${staticServer}/inc/js/pageset.js"></script>
	<script src="${staticServer}/inc/js/datepicker.js"></script>
	
	<style>
	.Zebra_DatePicker {
    	z-index: 99999;
	}
	</style>
    <script>
        $(function(){
            $("#nickname").val("${nickName}");

        });

        var selectMsg = function(){
            var nickName = $("#nickname").val();
            var dates = $("#dates").val();
            window.location.href=encodeURI("${contextPath}/index/performance_info.htm?nickName="+nickName+"&dates="+dates);
        }

        function addPerformanceInfo(id){
        	$("#id").val("");
			$("#username").val("");
			$("#levle").val("");
			$("#date").val("");
			
        	$.post("${contextPath}/index/get_performance_info_byid.json", {
					"id":id
				}, function(ms) {
					 var perInfo = ms.performanceInfo;
					 if(perInfo!=null){
					 	$("#id").val(id);
					 	$("#username").val(perInfo.username);
					 	$("#levle").val(perInfo.levle);
					 	$("#date").val(perInfo.date);
					 }
					 
					 $('.theme-popover-mask').fadeIn(100);
           			 $('.theme-popover').slideDown(200);
            		 $('.theme-poptit .close').click(function(){
               		 $('.theme-popover-mask').fadeOut(100);
                	 	$('.theme-popover').slideUp(200);
            		 })
                });
                
           
        }
        
        function save(){
            	var id = $("#id").val();
                var username = $("#username").val();
                var levle = $("#levle").val();
                var date = $("#date").val();
                $.post("${contextPath}/index/add_performance_info.json", {
					"id":id,
					"username":username,
					"levle":levle,
					"date":date
				}, function(ms) {
					 if (ms.msg=="1"){
                         infopad.msg("添加成功");
                         window.location.href=encodeURI("${contextPath}/index/performance_info.htm");
                     }else if (ms.msg=="0"){
                         infopad.err("该记录已经存在!");
                     }
                });
        }
        
        function addAll(){
            	var date = $("#date1").val();
                var date2 = $("#date2").val();
                $.post("${contextPath}/index/add_performance_info_all.json", {
					"date":date,
					"date2":date2
				}, function(ms) {
					 if (ms.msg=="1"){
                         infopad.msg("添加成功");
                         window.location.href=encodeURI("${contextPath}/index/performance_info.htm");
                     }else if (ms.msg=="2"){
                         infopad.err("该记录已存在!");
                     }else if (ms.msg=="0"){
                         infopad.err(date+"没有记录!");
                     }
                });
        }

    </script>
</head>

<body>
<input type="hidden" id="id" value="">
<div id="home_link">
    <ul>
        <li></li>
        <li>&gt;</li>
        <li>帐号管理</li>
        <li>&gt;</li>
        <li class="current"></li>
    </ul>
</div>
<div id="container">
    <div id="title"></div>
    <table class="form_table">
        <tr>
            <td><label><b>查询条件：</b></label>
                <label for="nickname">姓名：</label>
                <input type="text" name="nickname" id="nickname" size="15" value="" />
                <input type="text" id="dates" size="15" maxlength="20" rel="DATE::Y-m" />
                <input type="button" value=" 查 询 " onclick="selectMsg()" />
                <input type="button"  value=" 添 加 " onclick="addPerformanceInfo()" />
                
               <label for="nickname">复制</label>
               <input type="text" id="date1" size="15" maxlength="20" rel="DATE::Y-m" />
               <label for="nickname">到</label>
               <input type="text" id="date2" size="15" maxlength="20" rel="DATE::Y-m" />
               <input type="button" value=" 确定 " onclick="addAll()" />
            </td>
        </tr>
    </table>
    <table>
        <tr class="fields">
            <th>老师姓名</th>
            <th>日期</th>
            <th>等级</th>
            <th>工资基准值</th>
            <th>绩效工资最高值</th>
            <th width="20%">操作</th>
        </tr>

    <#if list??>
        <#list list as list>
            <tr class="even_row">
                <td align="center" class="stress">${list.nickname}</td>
                <td align="center" rel="nohover">${list.date}</td>

                <td align="center">${list.levle}</td>
                <td align="center">${list.pay}</td>
                <td align="center">${list.pay_max}</td>
                <td align="center">
                    <input type="button"  class="btn btn-primary" value="修改" onclick="addPerformanceInfo('${list.id}')" />
                </td>
            </tr>
        </#list>
    </#if>

    </table>
</div>

<div class="emptyline"></div>
<div class="theme-popover">
    <div class="theme-poptit">
        <a href="javascript:;" title="关闭" class="close">×</a>
        <h3>添加</h3>
    </div>
    <div class="theme-popbod dform">
        <form class="theme-signin" >
            <ol>
                <li><strong>用户名：</strong>
                    <select id="username">
                    <#if uList??>
                    	<option value="">请选择</option>
                        <#list uList as list>
                            <option value="${list.username}">${list.nickname}（${list.regions}-${list.departments}-${list.job}）</option>
                        </#list>
                    </#if>
                    </select >

                <li><strong>&nbsp;等级 ：</strong>
                    <select id="levle">
                        <option value="">请选择</option>
                        <#if levlist??>
                        	<#list levlist as levlist>
                        		<option value="${levlist.name}">${levlist.name}(${levlist.pay}-${levlist.pay_max})</option>
                        	</#list>
                        </#if>
                    </select>
                <li>
                <li><strong>&nbsp;日期 ：</strong>
                	 <input type="text" id="date" value="" size="15" maxlength="20" rel="DATE::Y-m" />
                <li>
                
                    <input class="btn btn-primary" type="button"  onclick="save()" value=" 保 存 " /></li>
            </ol>
        </form>
    </div>
</div>
<div class="theme-popover-mask"></div>
<div id="pager" style="width: 849px;">
    <ul id="pagination">
    <#if page??>
        <#if page.pagetotal?? && page.pagetotal!="0">
            <#assign pagetotal = page.pagetotal>
        <#else>
            <#assign pagetotal = 1>
        </#if>
        <#if page.currpage??>
            <#assign currpage = page.currpage>
        <#else>
            <#assign currpage = 1>
        </#if>
        <#if currpage==1 >
            <li class="previous-off">上一页</li>
        <#else>
            <li class="previous"><a href="${contextPath}/index/performance_info.htm?currPage=${currpage-1}&nickName=${nickName}&dates=${dates}">上一页</a></li>
        </#if>

        <#if pagetotal<=11>
            <#list 1..pagetotal as index_up>
                <#if currpage==index_up >
                    <li class="current">${index_up}</li>
                <#else>
                    <li><a href="${contextPath}/index/performance_info.htm?currPage=${index_up}&nickName=${nickName}&dates=${dates}">${index_up}</a></li>
                </#if>
            </#list>
        <#else>
            <#if currpage<=8 >
                <#list 1..9 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li><a href="${contextPath}/index/performance_info.htm?currPage=${index_up}&nickName=${nickName}&dates=${dates}">${index_up}</a></li>
                    </#if>
                </#list>
                <li>...</li>
                <li><a href="${contextPath}/index/performance_info.htm?currPage=${pagetotal}&nickName=${nickName}&dates=${dates}">${pagetotal}</a></li>

            <#elseif (currpage>= 9 && currpage<pagetotal-7)  >
                <li><a href="${contextPath}/index/performance_info.htm?currPage=1&nickName=${nickName}&dates=${dates}">1</a></li>
                <li>...</li>
                <#list currpage-3..currpage+3 as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li><a href="${contextPath}/index/performance_info.htm?currPage=${index_up}&nickName=${nickName}&dates=${dates}">${index_up}</a></li>
                    </#if>
                </#list>
                <li>...</li>
                <li><a href="${contextPath}/index/performance_info.htm?currPage=${pagetotal}&nickName=${nickName}&dates=${dates}">${pagetotal}</a></li>
            <#else>
                <li><a href="${contextPath}/index/performance_info.htm?currPage=1&nickName=${nickName}&dates=${dates}">1</a></li>
                <li>...</li>
                <#list pagetotal-8..pagetotal as index_up>
                    <#if currpage==index_up >
                        <li class="current">${index_up}</li>
                    <#else>
                        <li><a href="${contextPath}/index/performance_info.htm?currPage=${index_up}&nickName=${nickName}&dates=${dates}">${index_up}</a></li>
                    </#if>
                </#list>
            </#if>

        </#if>
        <#if currpage==pagetotal >
            <li class="previous-off">下一页</li>
        <#else>
            <li class="previous"><a href="${contextPath}/index/performance_info.htm?currPage=${currpage+1}&nickName=${nickName}&dates=${dates}">下一页</a></li>
        </#if>
        <li class="pageinfo">共${page.total}条记录</li>
    </#if>
    </ul>
</div>

</body>
</html>